import download from '@/utils/download'
import { getFileById } from '@/api/develop/file'
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗

export function useFilePreview() {
  /** 预览 */
  const downloadFile = async (id: string | number, fileName: string) => {
    try {
      const data = await getFileById({
        id
      })
      download.common(data, fileName)
    } catch (error) {
      message.error(error)
    }
  }
  return {
    downloadFile
  }
}
